package com.qiguliuxing.dts.common.type;

import lombok.RequiredArgsConstructor;

/**
 * 订单状态 枚举
 * @author qiguliuxing
 * @since  1.0.0
 */
@RequiredArgsConstructor
public enum OrderStatusEnum {

    //未付款
    CREATE((short)101, "未付款"),

    //已取消
    CANCEL((short)102, "已取消"),

    //已取消(系统)
    AUTO_CANCEL((short)103, "已取消(系统)"),

    //已付款
    PAY((short)201, "已付款"),

    //退款中
    REFUND((short)202, "订单取消，退款中"),

    //已退款
    REFUND_CONFIRM((short)203, "已退款"),

    //团购中
    GROUPON_ING((short)204, "团购中"),

    //赠予中
    GIFT_ING((short)205, "赠予中"),

    //已发货
    SHIP((short)301, "已发货"),

    //已收货
    CONFIRM((short)401, "已收货"),

    //已收货(系统)
    AUTO_CONFIRM((short)402, "已收货(系统)");

    public final Short status;
    public final String desc;

    public static OrderStatusEnum getInstance(Short status) {
        if (status != null) {
            for (OrderStatusEnum tmp : OrderStatusEnum.values()) {
                if (tmp.status.intValue() == status.intValue()) {
                    return tmp;
                }
            }
        }
        return null;
    }
}
